package com.yulongtian.offers.day202302;

import java.util.ArrayList;
import java.util.List;

/**
 * https://leetcode.cn/problems/cells-in-a-range-on-an-excel-sheet/
 * 可
 *
 * @author yulongTian
 * @create 2023-02-02 21:41
 */
public class Test01 {
    public static void main(String[] args) {

    }

    public static List<String> cellsInRange(String s) {
        List<String> ans = new ArrayList<>();
        int hang1 = s.charAt(1) - '0';
        int hang2 = s.charAt(4) - '0';

        int lie1 = s.charAt(0) - 'A';
        int lie2 = s.charAt(3) - 'A';

        for (int i = lie1; i <= lie2; i++) {
            for (int j = hang1; j <= hang2; j++) {
                ans.add("" + (char) (i + 'A') + j);
            }
        }
        return ans;
    }
}
